package com.greenx.hello;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @author Stephen Xianwei Zhang
 * 
 */
public class HelloBase {

	public static void main(String[] args) {
		// testBreak();
		Map<String, String> hm = new HashMap<String, String>();
		hm.put("a1", "a2");
		hm.put("a2", "a3");
		hm.put("a3", "a4");
		hm.put("a4", "a5");
		hm.put("a5", "a6");
		testIterate(hm, "a1");

	}

	public static void testIterate(Map<String, String> hm, String init) {

		String val = hm.get(init);
		//System.out.println("init:" + init + " val:" + val);
		if (val == null) {
			return;
		} else if (val.length() > 0) {
			testIterate(hm, val);
		}
		System.out.println("init:" + init + " val:" + val);
	}

	public static void testBreak() {
		int cycle = 20;
		for (int i = 0; i < cycle; i++) {
			System.out.println(i);
			if (i == 10) {
				break;
			}

		}

	}

}
